import { defineStore } from "pinia";
import { SignIn, getSignInfo } from "../api/index.js";
export const useSignInStore = defineStore("signIn", {
  state: () => {
    return {
      Number: 0,
      items: [],
    };
  },
  getters: {},
  actions: {
    getInfo() {
      getSignInfo()
        .then((res) => {
          this.Number = res.data.data.items.length;
          this.items = res.data.data.items;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    updateInfo(date) {
      SignIn(date)
        .then((res) => {
          this.getInfo();
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
});
